home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / delphi.swg / 0035_Undo in a Memo field.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-11-22  |  623 b   |  24 lines

  1.  
  2. Doing an UnDo in a Memo Field:
  3.  
  4.   If you have a pop-up menu in a TMemo, and put shortcuts 
  5. on it for the Cut,Copy, Paste, then you can handle those 
  6. events, and call CuttoClipBoard, CopytoClipBoard, etc.
  7.  
  8.   However, if you put an Undo option onto your pop-up menu 
  9. (normally Ctrl-Z) how do you instruct the TMemo to do the Undo?
  10. If the built-in undo is sufficient, you can get it easier than
  11. a Ctrl+Z:
  12.  
  13.     Memo1.Perform(EM_UNDO, 0, 0);
  14.  
  15.  To check whether undo is available so as to enable/disable 
  16.  
  17. an undo menu item:
  18.  
  19.     Undo1.Enabled := Memo1.Perform(EM_CANUNDO, 0, 0) <> 0;
  20.  
  21.                
  22.  
  23.  
  24.